<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller{

	public function index(){

		//pagination
		$config['base_url'] = 'http://127.0.0.1:8080/php2projektarbete/index.php/home/index/';
		$config['total_rows'] = $this->db->get('posts')->num_rows();
    	$config['per_page'] = '3';
    	$config['num_links'] = '3';
    	$config['full_tag_open'] = '<div id="pagination">';
    	$config['full_tag_close'] = '</div>';
    	
    	$this->pagination->initialize($config);

		$data['allposts'] = $this->post_model->list_posts($config['per_page'],$this->uri->segment(3));

		$data['content'] = SHOW_POSTS; 
		$this->load->view('index', $data);
	}
}